<?php
class Macys_Form_Configuration_UpdateKeys extends Zend_Form {

	protected $mcom_proxy = array();
	protected $mcom_service = array();

	protected $bcom_proxy = array();
	protected $bcom_service = array();

	public function init() {
		$con = Macys_Base_Config::getInstance();
		$keys = $con->getAllKeysForDisplay();

		foreach ($keys as $key => $value) {
			$names = explode('_', $key);
			$this->addElement('text',$key, array(
												'size' => 32,
												'label' => ucfirst($names[0]) ." ". $names[1] ." ". $names[2] ));
			if($names[0] == Macys_Base_Config::MCOMSITE) {
				if($names[1] == Macys_Base_Config::APIPROXY) {
					$this->mcom_proxy[] = $key;
				}
				if($names[1] == Macys_Base_Config::APISERVICES) {
					$this->mcom_service[] = $key;
				}
			}
			if($names[0] == Macys_Base_Config::BCOMSITE) {
				if($names[1] == Macys_Base_Config::APIPROXY) {
					$this->bcom_proxy[] = $key;
				}
				if($names[1] == Macys_Base_Config::APISERVICES) {
					$this->bcom_service[] = $key;
				}
			}
		}
		
		$this->addElement('submit','submit', array(
						'label' => 'Apply'));
				

		
		 $this->addDisplayGroups(array(
			
			
			'left' => array(
			'options'  => array('description' => 'Macys Proxy'),
			'elements' => $this->mcom_proxy
			),
			'right' => array(
			'options'  => array('description' => 'Macys Gateway'),
			//'elements' => array('mcom_mashery_catalog'),
			'elements' => $this->mcom_service,
			),
			
			
			'bcomleft' => array(
			'options'  => array('description' => 'Bloomingdales Proxy'),
			'elements' => $this->bcom_proxy
			),
			'bcomright' => array(
			'options'  => array('description' => 'Bloomingdales Gateway'),
			'elements' => $this->bcom_service
			),
			
			'bottom' => array(
			'elements' => array('submit'),
			),
			
			));

			$this->setDisplayGroupDecorators(array('Description', 'FormElements', 'Fieldset'));
			
	}

}